<?php
namespace App\Job;

use Hyperf\AsyncQueue\Annotation\AsyncQueueMessage;

use App\Repository\UserRepository;
use App\Repository\LevelRepository;

// 直推奖增加
class UserPrizeJob
{
    /**
     * @AsyncQueueMessage
     */
    public function push($id, $money, $content)
    {
        if($user = UserRepository::find($id))
        {
            // 等级
            $level = LevelRepository::make($user->level);
            
            // 算出奖
            $money = $level->userPrize($money);

            // 加入奖
            $user->moneyFullAdd($money, $content, 'user_prize');
        }
        
        
    }
}